﻿using System;
using System.Drawing;
using System.Windows.Forms;
using System.IO;
using GMusicBox.Core;

namespace GMusicBox
{
    public partial class frmAbout : PerPixelAlphaBlendForm
    {
        public frmAbout()
        {
            InitializeComponent();
            this.TopMost = Core.Setting.StandardSetting.TopMost;

            b = new Bitmap(res.about);
            Font f = new Font("微软雅黑", 9, FontStyle.Regular);
            Graphics g = Graphics.FromImage(b);
            g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
            g.DrawString(res.Version, f, Brushes.Black, new PointF(250, 75));
            g.DrawString("http://music.google.org.cn", f, Brushes.RoyalBlue, lnkWebSite.Location);
            g.Dispose();
            f.Dispose();
        }

        Bitmap b = null;

        private void frmAbout_Load(object sender, EventArgs e)
        {
            this.Show();
            for (double i = 0; i <= 1; i += 0.1)
            {
                this.SetBitmap(b, (byte)(255 * i));
                this.Refresh();
                System.Threading.Thread.Sleep(25);
            }
        }

        private void frmAbout_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                for (double i = 1; i >= 0; i -= 0.1)
                {
                    this.SetBitmap(b, (byte)(255 * i));
                    System.Threading.Thread.Sleep(25);
                }
            }
            catch { }
        }

        private void frmAbout_Deactivate(object sender, EventArgs e)
        {
            this.Close();
        }

        private void frmAbout_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void lnkWebSite_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            System.Diagnostics.Process.Start("http://music.google.org.cn/");
        }
    }
}
